home *** CD-ROM | disk | FTP | other *** search
- <?
- /* Written by johnm */
- function getMyServerURIPath() {
- /** Get current URI Path on Server, including protocol + trailing slash **/
-
- /* get protocol */
- $currURL = "http";
- if (array_key_exists("HTTPS", $_SERVER) && strtolower($_SERVER["HTTPS"]) == 'on') {
- $currURL.="s";
- }
- $currURL.= "://";
- /* add server name */
- $currURL.= $_SERVER['HTTP_HOST'];
-
- /* get path name */
- /* try to use PHP_SELF first... */
- if (!empty($_SERVER['PHP_SELF'])) {
- $strScript = $_SERVER['PHP_SELF'];
- } else if (!empty($_SERVER['SCRIPT_NAME'])) {
- /* otherwise, try SCRIPT_NAME */
- $strScript = $_SERVER['SCRIPT_NAME'];
- } else {
- /* last resort - quit out and return nothing */
- $strScript ="/" ; //return null;
- }
- /* remove filename */
- /* find last frontslash in filename */
- $intLastSlash = strrpos($strScript, '/');
- /* check if last backslash is more far away in filename */
- if (strrpos($strScript, "\\")>$intLastSlash) {
- /* if so, use the backslash position instead */
- $intLastSlash = strrpos($strScript, "\\");
- }
- /* cut out the filename */
- if ($intLastSlash==0)
- { $currURL.= $strScript; }
- else
- { $currURL.= substr($strScript, 0, $intLastSlash+1); }
-
- /* done, return protocol + servername + path + trailing slash */
- return $currURL;
- }
-
- /* Written by johnm */
- function getMyServerFilePath() {
- /** Get current absolute File Path on Server, including drive, etc whatever we have **/
- /** including trailing slash (forward or backward, whatever) **/
- $currPath = $_SERVER['PATH_TRANSLATED'];
-
- /* find last frontslash in filename */
- $intLastSlash = strrpos($currPath, '/');
- /* check if last backslash is more far away in filename */
- if (strrpos($currPath, "\\")>$intLastSlash) {
- /* if so, use the backslash position instead */
- $intLastSlash = strrpos($currPath, "\\");
- }
-
- /* cut out the filename */
- if ($intLastSlash!=0)
- { $currPath = substr($currPath, 0, $intLastSlash+1); }
- return $currPath;
- }
- ?>